<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>bkn.bibtex.string_tools</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="bkn.bibtex-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/bibkn/">bkn.bibtex</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;bkn ::
        <a href="bkn.bibtex-module.html">Package&nbsp;bibtex</a> ::
        Module&nbsp;string_tools
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="bkn.bibtex.string_tools-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module string_tools</h1><p class="nomargin-top"><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html">source&nbsp;code</a></span></p>
<p>Miscellaneous tools for working with BibTeX strings, mostly for 
  converting between latex and other formats.</p>

<hr />
<div class="fields">      <p><strong>To Do:</strong>
        add module level documentation.
      </p>
      <strong>Copyright:</strong>
      <ul class="nomargin-top">
        <li>
        (c) 2004-2009, Jim Pitman, Dept. Statistics, U.C. Berkeley 
        &lt;http://www.stat.berkeley.edu/users/pitman&gt;
        </li>
        <li>
        (c) 2009-2010, Benjamin Kalish
        </li>
      </ul>
      <p><strong>License:</strong>
        This program is free software; you can redistribute it and/or 
        modify it under the terms of the GNU General Public License as 
        published by the Free Software Foundation; either version 2 of the 
        License, or (at your option) any later version.
        <p>This program is distributed in the hope that it will be useful, 
        but WITHOUT ANY WARRANTY; without even the implied warranty of 
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
        General Public License for more details.</p>
      </p>
</div><!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>bool</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="bkn.bibtex.string_tools-module.html#blank" class="summary-sig-name">blank</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Returns True if <code>text</code> is <code>None</code> or contains 
      only whitespace.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#blank">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="bkn.bibtex.string_tools-module.html#dehyphenate_words" class="summary-sig-name">dehyphenate_words</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Strips hyphens from hypenated words, ignoring, as much as possible, 
      hyphens in other contexts.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#dehyphenate_words">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="strip_punctuation"></a><span class="summary-sig-name">strip_punctuation</span>(<span class="summary-sig-arg">text</span>)</span><br />
      Strips punctuation from the supplied string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#strip_punctuation">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>str</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="bkn.bibtex.string_tools-module.html#tex2ascii" class="summary-sig-name">tex2ascii</a>(<span class="summary-sig-arg">tex</span>)</span><br />
      Convert TeX accents, math expressions, etc.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2ascii">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>str</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="bkn.bibtex.string_tools-module.html#tex2html" class="summary-sig-name">tex2html</a>(<span class="summary-sig-arg">tex</span>)</span><br />
      Convert TeX accents, math expressions, etc.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2html">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>str</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="bkn.bibtex.string_tools-module.html#tex2unicode" class="summary-sig-name">tex2unicode</a>(<span class="summary-sig-arg">tex</span>)</span><br />
      Convert TeX accents, math expressions, etc.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2unicode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a 
      href="bkn.bibtex.latex_converter.latex2ascii_converter.Latex2ASCIIConverter-class.html"
      class="link">Latex2ASCIIConverter</a></span>
    </td><td class="summary">
        <a name="LATEX_2_ASCII_CONVERTER"></a><span class="summary-name">LATEX_2_ASCII_CONVERTER</span> = <code title="Latex2ASCIIConverter()">Latex2ASCIIConverter()</code><br />
      A <a 
      href="bkn.bibtex.latex_converter.latex2ascii_converter.Latex2ASCIIConverter-class.html"
      class="link">Latex2ASCIIConverter</a> instance.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a 
      href="bkn.bibtex.latex_converter.latex2html_converter.Latex2HTMLConverter-class.html"
      class="link">Latex2HTMLConverter</a></span>
    </td><td class="summary">
        <a name="LATEX_2_HTML_CONVERTER"></a><span class="summary-name">LATEX_2_HTML_CONVERTER</span> = <code title="Latex2HTMLConverter()">Latex2HTMLConverter()</code><br />
      A <a 
      href="bkn.bibtex.latex_converter.latex2html_converter.Latex2HTMLConverter-class.html"
      class="link">Latex2HTMLConverter</a> instance.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a 
      href="bkn.bibtex.latex_converter.latex2unicode_converter.Latex2UnicodeConverter-class.html"
      class="link">Latex2UnicodeConverter</a></span>
    </td><td class="summary">
        <a name="LATEX_2_UNICODE_CONVERTER"></a><span class="summary-name">LATEX_2_UNICODE_CONVERTER</span> = <code title="Latex2UnicodeConverter()">Latex2UnicodeConverter()</code><br />
      A <a 
      href="bkn.bibtex.latex_converter.latex2unicode_converter.Latex2UnicodeConverter-class.html"
      class="link">Latex2UnicodeConverter</a> instance.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="blank"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">blank</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#blank">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Returns True if <code>text</code> is <code>None</code> or contains 
  only whitespace.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>text</code></strong> (<code>str</code>) - the string to test</li>
    </ul></dd>
    <dt>Returns: <code>bool</code></dt>
        <dd><code>True</code> if <code>text</code> is <code>None</code> or 
          contains only whitespace, <code>False</code> otherwise.</dd>
    <dt>Raises:</dt>
    <dd><ul class="nomargin-top">
        <li><code><strong class='fraise'>AttributeError</strong></code> - blank() will raise an error if its input doesn't act like a string.
        (In particular, it must respond to the strip() method.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="dehyphenate_words"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">dehyphenate_words</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#dehyphenate_words">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Strips hyphens from hypenated words, ignoring, as much as possible, 
  hyphens in other contexts.</p>
  <p>This method removes only single hyphens between alphabetic characters.
  Removed hyphens are replaced with a space.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="tex2ascii"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">tex2ascii</span>(<span class="sig-arg">tex</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2ascii">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert TeX accents, math expressions, etc. to ASCII.</p>
  <p>This function is simply a convenient wrapper for the methods provided 
  in the bkn.bibtex.latex_converter package.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>tex</code></strong> (<code>str</code>) - the TeX or LaTeX code to be converted.</li>
    </ul></dd>
    <dt>Returns: <code>str</code></dt>
        <dd>a human readable representation of the string produced by using 
          ASCII characters in place of LaTeX code where possible. Note that
          while this string consists only of ascii characters, it is still 
          represented as Unicode internally!</dd>
  </dl>
<div class="fields">      <p><strong>Warning:</strong>
        this is an inherently lossy conversion
      </p>
      <p><strong>To Do:</strong>
        add real world examples to the documentation for this method
      </p>
</div></td></tr></table>
</div>
<a name="tex2html"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">tex2html</span>(<span class="sig-arg">tex</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2html">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert TeX accents, math expressions, etc. to HTML.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>tex</code></strong> (<code>str</code>) - the TeX or LaTeX code to be converted.</li>
    </ul></dd>
    <dt>Returns: <code>str</code></dt>
        <dd>a human readable representation of the string produced by using 
          HTML code in place of LaTeX code where possible.</dd>
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        This function is simply a convenient wrapper for the methods 
        provided in the bkn.bibtex.latex_converter package.
      </p>
      <p><strong>Warning:</strong>
        this is an inherently lossy conversion
      </p>
      <p><strong>To Do:</strong>
        add real world examples to the documentation for this method
      </p>
</div></td></tr></table>
</div>
<a name="tex2unicode"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">tex2unicode</span>(<span class="sig-arg">tex</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="bkn.bibtex.string_tools-pysrc.html#tex2unicode">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert TeX accents, math expressions, etc. to Unicode.</p>
  <p>This function is simply a convenient wrapper for the methods provided 
  in the bkn.bibtex.latex_converter package.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>tex</code></strong> (<code>str</code>) - the TeX or LaTeX code to be converted.</li>
    </ul></dd>
    <dt>Returns: <code>str</code></dt>
        <dd>a human readable representation of the string produced by using 
          Unicode characters in place of LaTeX code where possible.</dd>
  </dl>
<div class="fields">      <p><strong>Warning:</strong>
        this is an inherently lossy conversion
      </p>
      <p><strong>To Do:</strong>
        add real world examples to the documentation for this method
      </p>
</div></td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="bkn.bibtex-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/bibkn/">bkn.bibtex</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Jul  4 23:10:58 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
